import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

export default new Router({
  mode: 'history',
  routes: [
    {
      path: '/',
      component: resolve => require(['page/index'], resolve),
      children: [
        // 首页
        {
          path: '/',
          meta: {isAuth: true},
          component: resolve => require(['page/home'], resolve)
        },
        // 打印订单
        {
          path: '/print',
          meta: {isAuth: true},
          component: resolve => require(['page/orderManage/print'], resolve)
        },
        {
          path: '/order/type/:type',
          meta: {isAuth: true},
          component: resolve => require(['page/orderManage'], resolve)
        },
        // 商品管理
        {
          path: '/goods',
          meta: {isAuth: true},
          component: resolve => require(['page/goodsManage'], resolve),
          children: [
            // 出售中
            {
              path: 'sale',
              meta: {isAuth: true},
              component: resolve => require(['page/goodsManage/sale'], resolve)
            },
            // 仓库中
            {
              path: 'store',
              meta: {isAuth: true},
              component: resolve => require(['page/goodsManage/store'], resolve)
            },
            // 违规下架
            {
              path: 'pulled',
              meta: {isAuth: true},
              component: resolve => require(['page/goodsManage/pulled'], resolve)
            },
            // 草稿箱
            {
              path: 'drafts',
              meta: {isAuth: true},
              component: resolve => require(['page/goodsManage/drafts'], resolve)
            },
            // 审核中商品
            {
              path: 'review',
              meta: {isAuth: true},
              component: resolve => require(['page/goodsManage/review'], resolve)
            },
            // 审核中商品
            {
              path: 'reviewFail',
              meta: {isAuth: true},
              component: resolve => require(['page/goodsManage/reviewFail'], resolve)
            },
            // 添加商品E电宝导入
            {
              path: 'eShopEnter',
              meta: {isAuth: true},
              component: resolve => require(['page/goodsManage/eShopEnter'], resolve)
            }
          ]
        },
        // 订单管理--新
        {
          path: '/order',
          meta: {isAuth: true},
          component: resolve => require(['page/orderAllMange'], resolve),
          children: [
            {
              path: '/',
              meta: {isAuth: true},
              component: resolve => require(['page/orderAllMange/commonOrder'], resolve)
            },
            // 普通订单详情页
            {
              path: 'cODetail/:orderid',
              meta: {isAuth: true},
              component: resolve => require(['page/orderAllMange/cOrderDetail'], resolve)
            },
            // 拼单订单列表
            {
              path: 'fight',
              meta: {isAuth: true},
              component: resolve => require(['page/orderAllMange/fightOrder'], resolve)
            },
            // 拼单订单--主订单详情
            {
              path: 'fMODetali/:ruleid',
              meta: {isAuth: true},
              component: resolve => require(['page/orderAllMange/fMainOrderDetail'], resolve)
            },
            // 退款订单列表
            {
              path: 'refund',
              meta: {isAuth: true},
              component: resolve => require(['page/orderAllMange/refundOrder'], resolve)
            },
            // 退款订单详情:reid:退款id
            {
              path: 'reodetail/:reid',
              meta: {isAuth: true},
              component: resolve => require(['page/orderAllMange/refundOrderDetail'], resolve)
            },
            // 发货订单列表
            {
              path: 'delivery',
              meta: {isAuth: true},
              component: resolve => require(['page/orderAllMange/deliveryGoods'], resolve)
            },
            // 打印订单
            {
              path: 'print/:orderid',
              meta: {isAuth: true},
              component: resolve => require(['page/orderAllMange/printOrder'], resolve)
            }
          ]
        },
        // 拼单管理
        {
          path: 'fightAlone',
          meta: {isAuth: true},
          component: resolve => require(['page/fightAlone'], resolve),
          children: [
            {
              path: 'launch',
              meta: {isAuth: true},
              component: resolve => require(['page/fightAlone/launch'], resolve)
            },
            {
              path: 'fightList',
              meta: {isAuth: true},
              component: resolve => require(['page/fightAlone/fightList'], resolve)
            },
            {
              path: 'fightDetail/:goodsRuleId',
              meta: {isAuth: true},
              component: resolve => require(['page/fightAlone/fightDetail'], resolve)
            }
          ]
        },
        // 订单管理
        // {
        //   path: '/order',
        //   meta: {isAuth: true},
        //   component: resolve => require(['page/orderManage'], resolve)
        // },
        // 订单管理详情
        // {
        //   path: '/order/:id',
        //   meta: {isAuth: true},
        //   component: resolve => require(['page/orderManage/detail'], resolve)
        // },
        // // 打印订单
        // {
        //   path: '/order/print/:id',
        //   meta: {isAuth: true},
        //   component: resolve => require(['page/orderManage/print'], resolve)
        // },
        // // 发货管理
        // {
        //   path: '/deliver',
        //   meta: {isAuth: true},
        //   component: resolve => require(['page/deliverManage'], resolve)
        // },
        // // 发货管理
        // {
        //   path: '/deliver/:status',
        //   meta: {isAuth: true},
        //   component: resolve => require(['page/deliverManage'], resolve)
        // },
        // 评论管理
        {
          path: '/comment',
          meta: {isAuth: true},
          component: resolve => require(['page/commentManage'], resolve)
        },
        // 退款管理
        // {
        //   path: '/refund',
        //   meta: {isAuth: true},
        //   component: resolve => require(['page/refundManage'], resolve)
        // },
        // // 退款管理详情
        // {
        //   path: '/refund/:id',
        //   meta: {isAuth: true},
        //   component: resolve => require(['page/refundManage/detail'], resolve)
        // },
        // 运费模板设置
        {
          path: '/carriage',
          meta: {isAuth: true},
          component: resolve => require(['page/carriageTemplateSet'], resolve)
        },
        // 新增运费模板
        {
          path: '/carriage/add',
          meta: {isAuth: true},
          component: resolve => require(['page/carriageTemplateSet/addCarriageTmpl'], resolve)
        },
        // 修改运费模板
        {
          path: '/carriage/edit/:id',
          meta: {isAuth: true},
          component: resolve => require(['page/carriageTemplateSet/addCarriageTmpl'], resolve)
        },
        // 装修
        {
          path: '/adorn',
          meta: {isAuth: true},
          component: resolve => require(['page/adorn'], resolve),
          children: [
            {
              path: 'pc',
              meta: {isAuth: true},
              component: resolve => require(['page/adorn/pc'], resolve)
            },
            {
              path: 'wap',
              meta: {isAuth: true},
              component: resolve => require(['page/adorn/wap'], resolve)
            }
          ]
        },
        // 银行卡管理
        {
          path: '/count',
          meta: {isAuth: true},
          component: resolve => require(['page/countManage'], resolve)
        }
      ]
    },
    // 商品管理
    {
      path: '/goods',
      meta: {isAuth: true},
      component: resolve => require(['page/goodsManage'], resolve),
      children: [
        // 添加
        {
          path: 'add',
          component: resolve => require(['page/goodsManage/add'], resolve)
        },
        // 添加商品选择商品分类
        {
          path: 'classify',
          meta: {isAuth: true},
          component: resolve => require(['page/goodsManage/classify'], resolve)
        },
         // 添加商品选择商品分类
        {
          path: 'classify/:id/:gdId',
          meta: {isAuth: true},
          component: resolve => require(['page/goodsManage/classify'], resolve)
        },
        // 添加商品的详细信息
        {
          path: 'info/:id',
          meta: {isAuth: true},
          component: resolve => require(['page/goodsManage/shopInfo'], resolve)
        }
         // 添加商品的详细信息
        // {
        //   path: 'info/:id/:gdId',
        //   meta: {isAuth: true},
        //   component: resolve => require(['page/goodsManage/shopInfo'], resolve)
        // },
        // 添加商品的详细信息
        // {
        //   path: 'info/:id/:gdId/:key',
        //   meta: {isAuth: true},
        //   component: resolve => require(['page/goodsManage/shopInfo'], resolve)
        // }
      ]
    },
    // 登录
    {
      path: '/login',
      component: resolve => require(['page/login'], resolve)
    },
    // 注册
    {
      path: '/register',
      component: resolve => require(['page/register'], resolve)
    },
    // 找回密码
    {
      path: '/forget',
      component: resolve => require(['page/forget'], resolve)
    },
    // 在线聊天
    {
      path: '/chat',
      meta: {isAuth: true},
      component: resolve => require(['page/chat'], resolve)
    }
  ]
})
